package top.bingoz.wanandroid.test

import retrofit2.Call
import retrofit2.mock.BehaviorDelegate
import top.bingoz.wanandroid.test.ApiService.Api
import top.bingoz.wanandroid.test.ApiService.UserInfo

object ApiMockService {
    /**
     * A mock implementation of the [GitHub] API interface.
     */
    internal class MockApi(private val delegate: BehaviorDelegate<Api>) : Api {


        private var ownerRepoContributors: ApiService.UserInfo? = null

        init {

        }

        override fun getUserInfo(): Call<ApiService.UserInfo> {
            var response = ApiService.UserInfo()

            return delegate.returningResponse(response).getUserInfo()

        }

        fun addUserInfo() {
            var repoContributors = ownerRepoContributors
            if (repoContributors == null) {
                repoContributors = UserInfo()
            }
            ownerRepoContributors = repoContributors
        }
    }

}